package com.jt.mall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jt.mall.common.po.SysUser;
import com.jt.mall.mapper.UserMapper;
import com.jt.mall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangning
 * @create 2021-12-23 15:44
 */
@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	@Override
	public List<SysUser> findAll() {
		return userMapper.findAll();
	}

	@Override
	public PageInfo<SysUser> list(Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<SysUser> userList = userMapper.findAll();

		//如果返回前的数据 和 数据库实体 对象数据一致 采下面方式
		//如果不一致，采用 PageInfo pageInfo = new PageInfo(); pageInfo.setList(shippingList);

		return new PageInfo<>(userList);
	}

}
